<!--
 * @Descripttion: 文本
 * @version: V1.0
 * @Author: GW
 * @Date: 2021-09-09 14:18:01
 * @LastEditors: GW
 * @LastEditTime: 2021-10-13 10:50:32
-->
<template>
    <section class="show-wrapper">
        <template v-if="data.text != null">
            <div class="text-box-to-editor" v-html="data.text">

            </div>
        </template>
        <template v-else>
            <div class="text-box">
                文本内容
            </div>
        </template>

    </section>
</template>

<script>
export default {
    name: 'Texts',
    props: {
        data: {
            type: Object,
            default: {}
        }
    },
    mounted () {
        //组件默认数据
        let { data } = this;
        let defaultData = {
            title: data.title ? data.title : '文本',
            text: data.text ? data.text : '文本内容',
            onEdit: false,
        }
        this.data = Object.assign(data, defaultData);
    }
}
</script>

<style lang="less" scoped>
    .show-wrapper {
        padding:6px 12px;
        .text-box {
            color: #333;
        }
    }
</style>
<style lang="less">
    .text-box-to-editor {
        img {
            width: 100% !important;
        }
        p{
            margin-bottom: 3px;
        }
    }
</style>